﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sinacor.Process.Bovespa.Distribuicao.Server.Communication.Translator.DataContractToProcessEntity
{
    public class CalendarioOrdens
    {
        public ProcessEntity.Calendario ToCalendario(Bovespa.Calendario.CalendarioOrdens.CalendarioResponse from)
        {
            ProcessEntity.Calendario to = null;

            if (from != null)
            {
                to = new ProcessEntity.Calendario();

                to.CodigoPraca = from.CodigoPraca;
                to.DataPregao = from.DataPregao;
                to.TipoDia = from.TipoDia;
            }

            return to;
        }

        public List<ProcessEntity.Calendario> ToCalendario(List<Bovespa.Calendario.CalendarioOrdens.CalendarioResponse> from)
        {
            List<ProcessEntity.Calendario> to = null;

            if (from != null)
            {
                to = new List<ProcessEntity.Calendario>();

                foreach (Bovespa.Calendario.CalendarioOrdens.CalendarioResponse item in from)
                {
                    to.Add(ToCalendario(item));
                }
            }

            return to;
        }
    }
}
